package com.ys.web.mobao.util;

import com.ys.web.pay.PayEnum;

public class SxyKJEnum {

    private final static String NUKNOW = "未知枚举";

    /**
     * 银行卡绑定
     */
    public enum TRUSTEESHIPSTATUS{
        签约成功("INIT","请求成功"),处理中("PROCESS","处理中"),绑卡成功("SUCCESS","绑卡成功"),失败("FAIL","失败"),已解绑("UNBIND","已解绑");

        /** 状态值 */
        private String code;
        private String desc;

        TRUSTEESHIPSTATUS(String code,String desc) {
            this.code = code;
            this.desc = desc;
        }

        public String getCode() {
            return code;
        }

        public String getDesc() {
            return desc;
        }

        public static String getDescByCode(String code) {
            for (TRUSTEESHIPSTATUS value : TRUSTEESHIPSTATUS.values()) {
                if (value.getCode().equals(code)) {
                    return value.getDesc();
                }
            }
            return "";
        }
    }

    // 订单支付状态
    public enum PayStatus {
        未支付("0", "INIT"), 已支付("1", "SUCCESS"), 支付失败("2", "FAILED"), 取消("3", "CANCEL");
        private String code;
        private String name;

        PayStatus(String code, String name) {
            this.code = code;
            this.name = name;
        }

        public String getCode() {
            return code;
        }

        public String getName() {
            return name;
        }

        public static String getCodeByName(String key) {
            for (PayEnum.PayStatus object : PayEnum.PayStatus.values()) {
                if (object.getName().equals(key)) {
                    return object.getCode();
                }
            }
            return NUKNOW;
        }
    }


    // 订单支付状态
//    public enum PayStatus {
//        未支付("0", "INIT"), 已支付("1", "SUCCESS"), 支付失败("2", "FAILED"), 取消("3", "CANCEL");
//        private String code;
//        private String name;
//
//        PayStatus(String code, String name) {
//            this.code = code;
//            this.name = name;
//        }
//
//        public String getCode() {
//            return code;
//        }
//
//        public String getName() {
//            return name;
//        }
//
//        public static String getCodeByName(String key) {
//            for (PayEnum.PayStatus object : PayEnum.PayStatus.values()) {
//                if (object.getName().equals(key)) {
//                    return object.getCode();
//                }
//            }
//            return NUKNOW;
//        }
//    }

    /** -----------------------------红包start----------------------------------**/
    // 红包类型
    public enum PaymentModeCode {
        银行卡(1, "BANK_CARD-EXPRESS_DEBIT"), 支付宝(2, "ALIPAY-OFFICIAL");
        private int code;
        private String name;

        PaymentModeCode(int code, String name) {
            this.code = code;
            this.name = name;
        }

        public int getCode() {
            return code;
        }

        public String getName() {
            return name;
        }

        public static String getObjectByCode(int key) {
            for (PaymentModeCode object : PaymentModeCode.values()) {
                if (object.code==key) {
                    return object.name;
                }
            }
            return null;
        }
    }

    // 红包状态
    public enum RedPackageStatus {
        NoPay("0", "未支付"),Processing("1", "进行中"),
        Complete("2", "已完成"), Expire("3", "已过期");
        private String code;
        private String name;

        RedPackageStatus(String code, String name) {
            this.code = code;
            this.name = name;
        }

        public String getCode() {
            return code;
        }

        public String getName() {
            return name;
        }

        public static RedPackageStatus getObjectByCode(String key) {
            for (RedPackageStatus object : RedPackageStatus.values()) {
                if (object.getCode().equals(key)) {
                    return object;
                }
            }
            return null;
        }

        public static String getDescByCode(String code) {
            for (RedPackageStatus value : RedPackageStatus.values()) {
                if (value.code.equals(code)) {
                    return value.name;
                }
            }
            return "";
        }

        public static String getShowType(String code){
            if(code.equals("1")){
                return "1";
            }else {
                return "2";
            }
        }

        public static boolean showHis(String code){
            if(code.equals("1")){
                return true;
            }else {
                return false;
            }
        }
    }

    // 提现状态
    public enum TransferStatus {

        APPLY_FAIL("1", "申请失败"), APPLY_SUCCESS("2", "申请成功"),
        TRANSFER_SUCCESS("3", "转账成功"),TRANSFER_FAIL("4", "转账失败");

        private String code;
        private String name;

        TransferStatus(String code, String name) {
            this.code = code;
            this.name = name;
        }

        public String getCode() {
            return code;
        }

        public String getName() {
            return name;
        }

        public static String getDescByCode(String code) {
            for (TransferStatus value : TransferStatus.values()) {
                if (value.code.equals(code)) {
                    return value.name;
                }
            }
            return "";
        }
    }
    /** -----------------------------红包end----------------------------------**/

    // 提现状态
    public enum WithdrawStatus {

        APPLY_WITHDRAWAL("1", "提现中"), WITHDRAWAL_SUCCESS("2", "提现成功"),
        WITHDRAWAL_FAIL("3", "提现失败"),WITHDRAWAL_WAIT("4", "提现审核"),
        WITHDRAWAL_EXC("5", "提现异常");

        private String code;
        private String name;

        WithdrawStatus(String code, String name) {
            this.code = code;
            this.name = name;
        }

        public String getCode() {
            return code;
        }

        public String getName() {
            return name;
        }
    }
    // 提现审核状态
    public enum WithdrawWaitStatus {

        APPLY_WITHDRAWAL("1", "待审核"), WITHDRAWAL_SUCCESS("2", "通过"),
        WITHDRAWAL_FAIL("3", "冻结");

        private String code;
        private String name;

        WithdrawWaitStatus(String code, String name) {
            this.code = code;
            this.name = name;
        }

        public String getCode() {
            return code;
        }

        public String getName() {
            return name;
        }
    }
}
